package server.entity;

import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneOffset;

public class Coordinate {
    
    private LocalDateTime time;
    private String username;
    private Double longitude;
    private Double latitude;
    private String description;

    public Coordinate (LocalDateTime timeSent, String username, Double latitude, Double longitude){

        this.time = timeSent;
        this.username = username;
        this.latitude = latitude;
        this.longitude = longitude;

    }
    public Coordinate (LocalDateTime timeSent, String username, Double latitude, Double longitude,String description){

        this.time = timeSent;
        this.username = username;
        this.latitude = latitude;
        this.longitude = longitude;
        this.description=description;
    }

    public long getTimeAsLong(){
        return time.toInstant(ZoneOffset.UTC).toEpochMilli();
    }

    public void setTime(long time){
        this.time = LocalDateTime.ofInstant(Instant.ofEpochMilli(time), ZoneOffset.UTC);
    }

    public Double getLongitude(){
        return this.longitude;
    }

    public Double getLatitude(){
        return this.latitude;
    }

    public LocalDateTime getTime(){
        return this.time;
    }

    public String getUsername(){
        return this.username;
    }

    public void setDescription(String desc){
        this.description = desc;
    }

    public String getDescription(){
        return this.description;
    }

    public void setUsername(String username){
        this.username = username;
    }


}
